#include <iostream>
#include "../source/public.h"

void run()
{
    auto addr = framework::Address::LookupAny("0.0.0.0:6666");
    
    std::cout << *addr << std::endl;
    auto addr2 = framework::UnixAddress::ptr(new framework::UnixAddress("./temp/unix_addr"));
    std::cout << *addr2 << std::endl;

    std::vector<framework::Address::ptr> addrs;
    addrs.push_back(addr);
    // addrs.push_back(addr2);

    framework::TcpServer::ptr tcp_server(new framework::TcpServer);
    std::vector<framework::Address::ptr> fails;
    while(!tcp_server->bind(addrs, fails))
    {
        sleep(2);
    }
    tcp_server->start();
}

int main(void)
{
    framework::IOManager iom(2);
    iom.schedule(run);
    return 0;
}